package com.knowledge.graph.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.knowledge.graph.model.entity.VideoAndCourse;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @description: 视频和课程对象的数据库操作
 * @author jiwenlong
 * @date 2023/11/8 20:41
 * @version 1.0
 */
@Mapper
public interface VideoAndCourseMapper extends BaseMapper<VideoAndCourse> {

    @Delete("delete from video_and_course where course_id = #{courseID}")
    public int deleteByCourse(Integer courseID);

    @Select("select video_id from video_and_course where course_id = #{courseID}")
    public List<Integer> selectByCourseId(Integer courseID);

    @Delete("delete from video_and_course where video_id = #{videoID}")
    public int deleteByVideoID(Integer videoID);

    @Select("select course_id from video_and_course where video_id = #{videoID}")
    public int selectByVideoID(Integer videoID);
}
